' This program exported from BASIC Anywhere Machine (Version [5.2.3].[2024.09.09.00.00]) on 2025.07.17 at 00:22 (Coordinated Universal Time)
' Port (and slight mod), by Charlie Veniot, of an Apple II program shared by Guillermo Ibáñez
' with the "BASIC Programming Language" Facebook group (https://www.facebook.com/share/p/1CiSg3cB9V/)
' * LOC's with no numbers are additions
' * commented out lines are original program lines that have been replaced
' * all references to the variable "pif%" replace the orginal program's instances of the literal value "24"
ALERT( "After a graph has been drawn, click/touch the screen to regenerate the graph with a different random color." )
w% = 800 : h% = w%
SCREEN _NEWIMAGE( w%, h%, 17 )
COLOR , 63
CLS
points% = 23
start_drawing:
' 10 HGR
COLOR INT( RND * 63 )
' 20 R=70: X0=w%/2 : Y0=h%/2
20 r = h% / 2 - 10 : x0 = w% / 2 : y0 = h% / 2
30 pi = 3.1415927
40 FOR i = 0 TO points%
50 a1 = 2 * pi / points% * i
60 x1 = r * COS( a1 ) + x0
70 y1 = r * SIN( a1 ) + y0
80 FOR j = i + 1 TO points%
90 a2 = 2 * pi / points% * j
100 x2 = r * COS( a2 ) + y0
110 y2 = r * SIN( a2 ) + y0
' 120 HPLOT X1,Y1 TO X2,Y2
120 LINE ( x1, y1 ) TO ( x2, y2 )
SLEEP 0.001
130 NEXT j
140 NEXT i
SLEEP
GOTO start_drawing